<?php

namespace App\model;

use Illuminate\Database\Eloquent\Model;
class Login_ope extends Model
{
	/*
	*@content 权限
	*@author  
    */

	public $table = 'login_ope';
    public $timestamps = false;

	/**
	 * 登录记录
	 */
	 public function loginHistory($ip,$use_name)
	{
	  $time=date("Y-m-d H:i:s");
	  $this->insert([
		  'log_ip'=>$ip,
		  'log_time'=>$time,
		  'use_name'=>$use_name,
	  ]);
	  session(['log_time' =>$time]);
	 
	}

	/**
	 * 退出记录
	 */
	 public function quitHistory($use_name,$log_time)
	{
	   $this->where('use_name',$use_name)
		    ->where('log_time',$log_time)
		   ->update(['log_quittime'=>date("Y-m-d H:i:s")]);
	 
	}
}